package tech.aistar.service.impl.noteinfo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tech.aistar.entity.authordis.NoteAuthor;
import tech.aistar.entity.authordis.Notes;
import tech.aistar.entity.authordis.NotesInfo;
import tech.aistar.entity.authordis.UserTable;
import tech.aistar.mapper.noteinfo.INoteInfoMapper;
import tech.aistar.service.noteinfo.INoteInfoService;

import java.util.List;

/**
 * Created by lenovo on 2019/10/7.
 */
@Service
@Transactional
public class NoteInfoServiceImpl implements INoteInfoService{

    @Autowired
    private INoteInfoMapper noteInfoMapper;
    /**
     * 通过id获取用户信息
     * @param id
     * @return
     */
    @Override
    public UserTable findUserById(Integer id) {
        UserTable userTable = noteInfoMapper.findUserById(id);
        return userTable;
    }

    /**
     * 通过id获取游记信息
     * @param id
     * @return
     */
    @Override
    public Notes findNotesById(Integer id) {
        Notes notes = noteInfoMapper.findNotesById(id);
        return notes;
    }

    /**
     *通过id获取游记作者信息
     * @param id
     * @return
     */
    @Override
    public NoteAuthor findNoteAuthorById(Integer id) {
        NoteAuthor noteAuthor = noteInfoMapper.findNoteAuthorById(id);
        return noteAuthor;
    }
    /**
     * 部分读取文本
     * @param id
     * @return
     */
    @Override
    public List<NotesInfo> findPartById(Integer id) {
        List<NotesInfo> list= noteInfoMapper.findPartById(id);
        return list;
    }
    /**
     * 读取全部文本
     * @param id
     * @return
     */
    @Override
    public List<NotesInfo> findAllById(Integer id) {
        List<NotesInfo> list = noteInfoMapper.findAllById(id);
        return list;
    }

    /**
     * 根据游记的所属地点,查询相关游记
     * @param notePlace
     * @return
     */
    @Override
    public List<Notes> findRelNotes(String notePlace) {
        List<Notes> notes = noteInfoMapper.findRelNotes(notePlace);
        return notes;
    }

    @Override
    public NotesInfo findconById(Integer id) {
        NotesInfo notesInfo =noteInfoMapper.findconById(id);
        return notesInfo;
    }
}
